<!DOCTYPE html>
<html lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>已发布作业</title>
    <div th:replace="common/student_commonElement :: css"></div>
    <style>
        .tree li {
            list-style-type: none;
            cursor: pointer;
        }

        .tree-closed {
            height: 40px;
        }

        .tree-expanded {
            height: auto;
        }
    </style>
</head>

<body>
<div th:replace="common/student_commonElement :: nav"></div>
<div class="row">
    <div th:replace="common/student_commonElement :: sider"></div>
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title"><i class="glyphicon glyphicon-th"></i> 已发布作业列表</h3>
            </div>
            <hr style="clear:both;">
            <div class="table-responsive">
                <table class="table  table-bordered">
                    <thead>
                    <tr>
                        <th>课程编号</th>
                        <th>课程名称</th>
                        <th>截止日期</th>
                        <th width="100">操作1</th>
                        <th width="100">操作2</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="issue : ${pageQueryUtils.list}">
                        <td th:text="${issue.id}">1906Z12143</td>
                        <td th:text="${issue.homeworkName}">贾佚然</td>
                        <td th:text="${issue.expirationTime}">贾佚然</td>
                        <td>
                            <form method="post" th:action="@{/student/downloadHomework}">
                                <input type="hidden" name="filePath" th:value="${issue.homeworkPath}">
                                <button type="submit" class="layui-btn layui-btn-primary">
                                    下载作业
                                </button>
                            </form>
                        </td>
                        <td>
                            <button type="button" class="layui-btn layui-btn-primary submitHomework"
                                    th:onclick="toSubmitHomework([[${issue.id}]])">
                                提交作业
                            </button>
                        </td>
                    </tr>
                    </tbody>
                    <tfoot>
                    <tr>
                        <td colspan="12" align="center">
                            <ul class="pagination">
                                <li>
                                    <a th:href="@{/student/toHomeworkList(pageNum=${pageQueryUtils.prePageNum},cid=${cid})}">上一页</a>
                                </li>

                                <li>
                                    <a th:href="@{/student/toHomeworkList(pageNum=${pageQueryUtils.pageNum},cid=${cid})}">[[${pageQueryUtils.pageNum}]]</a>
                                </li>
                                <li>
                                    <a th:href="@{/student/toHomeworkList(pageNum=${pageQueryUtils.nextPageNum},cid=${cid})}">下一页</a>
                                </li>
                            </ul>
                        </td>
                    </tr>

                    </tfoot>
                </table>
            </div>
        </div>
    </div>
</div>
<div th:replace="common/student_commonElement :: jsFile"></div>
<script type="text/javascript">
    layui.use('layer', function () {
        var layer = layui.layer;
    });

    $(function () {
        $(".list-group-item").click(function () {
            if ($(this).find("ul")) {
                $(this).toggleClass("tree-closed");
                if ($(this).hasClass("tree-closed")) {
                    $("ul", this).hide("fast");
                } else {
                    $("ul", this).show("fast");
                }
            }
        });
    });

    function toSubmitHomework(id) {
        window.location.href = projectPath + "/student/toSubmitHomework?id=" + id;
    }

</script>
</body>
</html>